% tkz-obj-eu-draw-triangles.tex
% Copyright 2020  Alain Matthes
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status “maintained”.
%
% The Current Maintainer of this work is Alain Matthes.

%  utf8 encoding
%<--------------------------------------------------------------------------–>
%                       Draw Triangles
%<--------------------------------------------------------------------------–>

\def\tkz@numdtr{0}
\pgfkeys{/drawtriangle/.cd,
      equilateral/.code         = {\def\tkz@numdtr{0}},
      half/.code                = {\def\tkz@numdtr{1}},
      pythagore/.code           = {\def\tkz@numdtr{2}},
      school/.code              = {\def\tkz@numdtr{3}},
      golden/.code              = {\def\tkz@numdtr{4}},
      sublime/.code             = {\def\tkz@numdtr{4}},
      euclide/.code             = {\def\tkz@numdtr{5}},
      gold/.code                = {\def\tkz@numdtr{6}},
      cheops/.code              = {\def\tkz@numdtr{7}},
      two angles/.code  args    = {#1 and #2}{\def\tkz@numdtr{8}%
                                              \def\tkz@alpha{#1}%
                                              \def\tkz@beta{#2}},
      equilateral,
   /drawtriangle/.search also={/tikz}
}

\def\tkzDrawTriangle{\pgfutil@ifnextchar[{\tkz@DrawTriangle}{%
                                         \tkz@DrawTriangle[]}}
\def\tkz@DrawTriangle[#1](#2,#3){%
\begingroup
\pgfkeys{/drawtriangle/.cd,equilateral}
\pgfqkeys{/drawtriangle}{#1}
\ifcase\tkz@numdtr%
   \tkzDefEquilateral(#2,#3)
\or% 1
   \tkzDefTwoOne(#2,#3)
\or% 2
   \tkzDefPythagore(#2,#3)
\or% 3
   \tkzDefSchoolTriangle(#2,#3)
\or% 4
   \tkzDefGoldenTriangle(#2,#3)
\or% 5
   \tkzDefEuclideTriangle(#2,#3)
\or% 6
   \tkzDefGoldTriangle(#2,#3)
\or% 7
   \tkzDefCheopsTriangle(#2,#3)
\or% 8
   \tkzDefTwoAnglesTriangle(#2,#3)
\fi
 \draw[/drawtriangle/.cd,line style,#1] (#2)--(#3)--(tkzPointResult)--cycle;
\endgroup
}

